<script setup>
import {useRouter} from "vue-router";
import useUserStore from '@/stores/user.js'


const userStore=useUserStore()
const router=useRouter()
const props = defineProps({
  categoryCollectRecordsObj: {
    type: Array,
    required: true
  },
  columnId:{
    type: String,
    default:''
  }
})


function goToContinue(row){
  if(row.type=='chapter'){
    router.push({
      path: `/questionBank/chapterPractice/practiceMode`, query: {
        categoryId: userStore.selectCategory.categoryId,
        columnId: props.columnId,
        chapterId: row.id,
        name: row.n,
        dc: row.dc,
        ec: row.ec,
        // cc: data.cc,
      }
    })
  }

}
</script>

<template>
  <div>
    <el-table :data="categoryCollectRecordsObj.records">
      <el-table-column lable="试题名称" prop="n">

      </el-table-column>
      <el-table-column label="操作">
        <template #default="scope">
          <el-button @click="goToContinue(scope.row)">做题</el-button>
        </template>
      </el-table-column>
    </el-table>

    <el-pagination background class="my-pagination" layout="prev, pager, next,sizes" :total="categoryCollectRecordsObj.total"
                   v-model:current-page="categoryCollectRecordsObj.current"
                   v-model:page-size="categoryCollectRecordsObj.size"/>
  </div>
</template>

<style scoped>
.my-pagination{
  margin-top: 32px;
}
</style>